/*
  RealTimeClock Library - Hello World
 
 Demonstrates the use of the DS1307 real time clock chip.
 
 This sketch sets the RTC to a start time of 8/1/2010 14:00
 and then prints the current time to Serial once a second.
 
  The circuit:
 * SDA to analog pin 4
 * SCL to analog pin 5
 * 5V and GND to their respective rail
 */

#include "RealTimeClock.h"
#include "Wire.h"

void setup() {
  Serial.begin(19200);
  Wire.begin();
  RTC.begin();
  
  // Set RTC to 8/1/2010 14:00
  struct tm initial_time = { 0 };
  initial_time.tm_hour = 14;
  initial_time.tm_mday = 1;
  initial_time.tm_mon = 8;
  initial_time.tm_year = 10;
  RTC.setDate(initial_time);
}

struct tm date;
void loop() {
  date = RTC.getDate();
  Serial.print(date.tm_year);
  Serial.print('-');
  Serial.print(date.tm_mon);
  Serial.print('-');
  Serial.print(date.tm_mday);
  Serial.print(' ');
  Serial.print(date.tm_hour);
  Serial.print(':');
  Serial.print(date.tm_min);
  Serial.print(':');
  Serial.println(date.tm_sec);
  
  delay(1000);
}

